package org.example.springboot.DTO;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
 * 图表数据DTO
 */
@Data
@Schema(description = "图表数据DTO")
public class ChartDataDTO {
    
    // 如果需要使用ChartDataDTO.builder()方法，需要手动添加一个静态builder方法
    public static ChartDataDTOBuilder builder() {
        return new ChartDataDTOBuilder();
    }
    
    // 手动创建Builder类
    public static class ChartDataDTOBuilder {
        public ChartDataDTO build() {
            return new ChartDataDTO();
        }
    }
    
    /**
     * 分类分布数据项
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "分类分布数据项")
    public static class CategoryItem {
        @Schema(description = "分类名称")
        private String name;
        
        @Schema(description = "图书数量")
        private Integer value;
    }
    
    /**
     * 借阅趋势数据
     */
    @Data
    @Schema(description = "借阅趋势数据")
    public static class BorrowTrendData {
        @Schema(description = "月份")
        private List<String> months;
        
        @Schema(description = "借出数据")
        private List<Integer> borrowData;
        
        @Schema(description = "归还数据")
        private List<Integer> returnData;
        
        public BorrowTrendData() {
            // 无参构造器
        }
        
        public BorrowTrendData(List<String> months, List<Integer> borrowData, List<Integer> returnData) {
            this.months = months;
            this.borrowData = borrowData;
            this.returnData = returnData;
        }
        
        // 静态Builder方法
        public static BorrowTrendDataBuilder builder() {
            return new BorrowTrendDataBuilder();
        }
        
        // 手动创建Builder类
        public static class BorrowTrendDataBuilder {
            private List<String> months;
            private List<Integer> borrowData;
            private List<Integer> returnData;
            
            public BorrowTrendDataBuilder months(List<String> months) {
                this.months = months;
                return this;
            }
            
            public BorrowTrendDataBuilder borrowData(List<Integer> borrowData) {
                this.borrowData = borrowData;
                return this;
            }
            
            public BorrowTrendDataBuilder returnData(List<Integer> returnData) {
                this.returnData = returnData;
                return this;
            }
            
            public BorrowTrendData build() {
                return new BorrowTrendData(months, borrowData, returnData);
            }
        }
    }
    
    /**
     * 用户活跃度数据项
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "用户活跃度数据项")
    public static class UserActivityItem {
        @Schema(description = "日期")
        private String day;
        
        @Schema(description = "活跃用户数")
        private Integer count;
    }
    
    /**
     * 热门图书数据项
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "热门图书数据项")
    public static class HotBookItem {
        @Schema(description = "图书名称")
        private String name;
        
        @Schema(description = "借阅次数")
        private Integer count;
    }

    /**
     * 高分图书项
     */
    @Data
    @AllArgsConstructor
    @Schema(description = "高分图书项")
    public static class TopRatedBookItem {
        @Schema(description = "图书名称")
        private String name;
        
        @Schema(description = "评分")
        private Double rating;
    }
} 